package com.zee.activity.ui;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.zee.activity.R;
import com.zee.activity.UITest;
import com.zee.utils.UIUtils;
import com.zee.utils.ZEventBusUtils;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.SubscribeMainThread;

/**
 * @author Administrator
 */
public class EventBusMainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ZEventBusUtils.register(this);
        setContentView(R.layout.activity_main);
        findViewById(R.id.id_test_1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventBus.getDefault().postTagNoParam("张鹏测试");
            }
        });

        findViewById(R.id.id_test_2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });

        UITest.run(new Runnable() {
            @Override
            public void run() {

            }
        }).onNextOnMainThread(new Runnable() {
            @Override
            public void run() {

            }
        });
    }



    @SubscribeMainThread(tag = "张鹏测试")
    public void testFun() {
        UIUtils.showToastShort("测试成功-->ok");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ZEventBusUtils.unregister(this);
    }
}
